package com.gravata.enigma.model;

import java.io.Serializable;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="satelite")
public class Satelite extends EntidadeAbstrata{

	private static final long serialVersionUID = 2692780216779356172L;

	public Satelite() {

	}

	@DatabaseField(generatedId=true)
	private int id;

	@DatabaseField(canBeNull=false,columnName="position")
	private int position;

	@DatabaseField(canBeNull=false,columnName="name")
	private String name;

	@DatabaseField(canBeNull=true,columnName="flags",dataType=DataType.ENUM_INTEGER)
	private Flags flags;

	@DatabaseField(foreign=true,foreignAutoRefresh=true)
	private Profile profile;

	@ForeignCollectionField(eager=false)
	private ForeignCollection<Transponder> transponders;

	public Serializable getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Flags getFlags() {
		return flags;
	}
	public void setFlags(Flags flags) {
		this.flags = flags;
	}

	public ForeignCollection<Transponder> getTransponders() {
		return transponders;
	}

	public void setTransponders(ForeignCollection<Transponder> transponders) {
		this.transponders = transponders;
	}

	public Profile getProfile() {
		return profile;
	}
	public void setProfile(Profile profile) {
		this.profile = profile;
	}

	public int getPosition() {
		return position;
	}
	public void setPosition(int position) {
		this.position = position;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + id;
		result = prime * result + position;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Satelite other = (Satelite) obj;
		if (id != other.id)
			return false;
		if (position != other.position)
			return false;
		return true;
	}


}
